package com.example.zk.vo;

import com.example.zk.enums.ResultStatusCode;
import lombok.Data;

import java.io.Serializable;

/**
 * Created by it001 on 2018-12-26.
 */
@Data
public class Result implements Serializable {

    private static final long serialVersionUID = 9094864478496665410L;

    private int code;		//返回的代码，0表示成功，其他表示失败
    private String msg;		//成功或失败时返回的错误信息
    private Object data;	//成功时返回的数据信息

    public Result(int code, String msg, Object data){
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public Result(ResultStatusCode resultStatusCode, Object data){
        this(resultStatusCode.getCode(), resultStatusCode.getMsg(), data);
    }

    public Result(int code, String msg){
        this(code, msg, null);
    }

    public Result(ResultStatusCode resultStatusCode){
        this(resultStatusCode, null);
    }
}
